//
//  ZoomImageView.m
//  Common
//
//  Created by HanHaiDi on 13-8-15.
//  Copyright (c) 2013年 xiong qi. All rights reserved.
//

#import "ZoomImageView.h"

@implementation ZoomImageView
@synthesize imgView;
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        imgScrollView=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        [imgScrollView setMaximumZoomScale:2.0];
        [imgScrollView setMinimumZoomScale:1.0];
        [imgScrollView setDelegate:self];
        [self addSubview:imgScrollView];
        [imgScrollView release];
        
        imgView=[[UIImageView alloc] initWithFrame:imgScrollView.bounds];
        [imgScrollView addSubview:imgView];
        imgView.contentMode = UIViewContentModeScaleAspectFill;
    }
    return self;
}

-(void)dealloc
{
    self.imgView=nil;
    [super dealloc];
}
#pragma UIScrollView Delegate
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return imgView;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
